<template>
  <div class="app">
    <van-nav-bar title="vue-有点东西" fixed left-text="返回" left-arrow @click-left="onClickLeft"/>

    <transition>
      <keep-alive>
        <router-view/>
      </keep-alive>
    </transition>

    <van-tabbar v-model="active">
      <van-tabbar-item icon="wap-home" to="/home">首页</van-tabbar-item>
      <van-tabbar-item icon="user-o" to="/member">会员</van-tabbar-item>
      <van-tabbar-item icon="shopping-cart-o" to="/shopping" :info="$store.getters.getAllCount">购物车</van-tabbar-item>
      <van-tabbar-item icon="search" to="/search">搜索</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      active: 0
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="less">
.app {
  padding-top: 46px;
  padding-bottom: 50px;
  overflow-x: hidden;
}
.v-enter {
  transform: translateX(100%);
}
.v-leave-to {
  transform: translateX(-100%);
  position: absolute;
}
.v-enter-active,
.v-leave-active {
  transition: all 0.3s ease;
}
.van-nav-bar--fixed {
  z-index: 999 !important;
}
</style>
